home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / gdb / gdb_18s.zoo / valprint.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-25  |  17.5 KB  |  679 lines

  1. /* Print values for GNU debugger gdb.
  2.    Copyright (C) 1986, 1988 Free Software Foundation, Inc.
  3.  
  4. GDB is distributed in the hope that it will be useful, but WITHOUT ANY
  5. WARRANTY.  No author or distributor accepts responsibility to anyone
  6. for the consequences of using it or for whether it serves any
  7. particular purpose or works at all, unless he says so in writing.
  8. Refer to the GDB General Public License for full details.
  9.  
  10. Everyone is granted permission to copy, modify and redistribute GDB,
  11. but only under the conditions described in the GDB General Public
  12. License.  A copy of this license is supposed to have been given to you
  13. along with GDB so you can know your rights and responsibilities.  It
  14. should be in a file named COPYING.  Among other things, the copyright
  15. notice and this notice must be preserved on all copies.
  16.  
  17. In other words, go ahead and share GDB, but don't try to stop
  18. anyone else from sharing it farther.  Help stamp out software hoarding!
  19. */
  20.  
  21. #include <stdio.h>
  22. #include "defs.h"
  23. #include "symtab.h"
  24. #include "value.h"
  25.  
  26. /* Maximum number of chars to print for a string pointer value
  27.    or vector contents.  */
  28.  
  29. static int print_max;
  30.  
  31. static void type_print_varspec_suffix ();
  32. static void type_print_varspec_prefix ();
  33. static void type_print_base ();
  34.  
  35. char **unsigned_type_table;
  36. char **signed_type_table;
  37. char **float_type_table;
  38.  
  39. /* Print the value VAL in C-ish syntax on stream STREAM.
  40.    FORMAT is a format-letter, or 0 for print in natural format of data type.
  41.    If the object printed is a string pointer, returns
  42.    the number of string bytes printed.  */
  43.  
  44. value_print (val, stream, format)
  45.      value val;
  46.      FILE *stream;
  47.      char format;
  48. {
  49.   register int i, n, typelen;
  50.  
  51.   if (val == 0)
  52.   {
  53.      printf_filtered ("<address of value unknown>");
  54.       return 0;
  55.   }
  56.  
  57.   /* A "repeated" value really contains several values in a row.
  58.      They are made by the @ operator.
  59.      Print such values as if they were arrays.  */
  60.  
  61.   if (VALUE_REPEATED (val))
  62.     {
  63.       n = VALUE_REPETITIONS (val);
  64.       typelen = TYPE_LENGTH (VALUE_TYPE (val));
  65.       fputc_filtered ('{', stream);
  66.       /* Print arrays of characters using string syntax.  */
  67.       if (typelen == 1 && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT
  68.       && format == 0)
  69.     {
  70.       fputc_filtered ('"', stream);
  71.       for (i = 0; i < n && i < print_max; i++)
  72.         {
  73.           QUIT;
  74.           printchar (VALUE_CONTENTS (val)[i], stream);
  75.         }
  76.       if (i < n)
  77.         fprintf_filtered (stream, "...");
  78.       fputc_filtered ('"', stream);
  79.     }
  80.       else
  81.     {
  82.       for (i = 0; i < n && i < print_max; i++)
  83.         {
  84.           if (i)
  85.         fprintf_filtered (stream, ", ");
  86.           val_print (VALUE_TYPE (val), VALUE_CONTENTS (val) + typelen * i,
  87.              VALUE_ADDRESS (val) + typelen * i, stream, format);
  88.         }
  89.       if (i < n)
  90.         fprintf_filtered (stream, "...");
  91.     }
  92.       fputc_filtered ('}', stream);
  93.       return n * typelen;
  94.     }
  95.   else
  96.     {
  97.       /* A simple (nonrepeated) value */
  98.       /* If it is a pointer, indicate what it points to.  */
  99.       if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_PTR)
  100.     {
  101.       fprintf_filtered (stream, "(");
  102.       type_print (VALUE_TYPE (val), "", stream, -1);
  103.       fprintf_filtered (stream, ") ");
  104.     }
  105.       return val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
  106.             VALUE_ADDRESS (val), stream, format);
  107.     }
  108. }
  109.  
  110. /* Print data of type TYPE located at VALADDR (within GDB),
  111.    which came from the inferior at address ADDRESS,
  112.    onto stdio stream STREAM according to FORMAT
  113.    (a letter or 0 for natural format).
  114.  
  115.    If the data are a string pointer, returns the number of
  116.    sting characters printed.  */
  117.  
  118. int
  119. val_print (type, valaddr, address, stream, format)
  120.      struct type *type;
  121.      char *valaddr;
  122.      CORE_ADDR address;
  123.      FILE *stream;
  124.      char format;
  125. {
  126.   register int i;
  127.   int len;
  128.   struct type *elttype;
  129.   int eltlen;
  130.   int val;
  131.   unsigned char c;
  132.  
  133.   QUIT;
  134.  
  135.   switch (TYPE_CODE (type))
  136.     {
  137.     case TYPE_CODE_ARRAY:
  138.       if (TYPE_LENGTH (type) >= 0)
  139.     {
  140.       elttype = TYPE_TARGET_TYPE (type);
  141.       eltlen = TYPE_LENGTH (elttype);
  142.       len = TYPE_LENGTH (type) / eltlen;
  143.       fprintf_filtered (stream, "{");
  144.       /* For an array of chars, print with string syntax.  */
  145.       if (eltlen == 1 && TYPE_CODE (elttype) == TYPE_CODE_INT
  146.           && format == 0)
  147.         {
  148.           fputc_filtered ('"', stream);
  149.           for (i = 0; i < len && i < print_max; i++)
  150.         {
  151.           QUIT;
  152.           printchar (valaddr[i], stream);
  153.         }
  154.           if (i < len)
  155.         fprintf_filtered (stream, "...");
  156.           fputc_filtered ('"', stream);
  157.         }
  158.       else
  159.         {
  160.           for (i = 0; i < len && i < print_max; i++)
  161.         {
  162.           if (i) fprintf_filtered (stream, ", ");
  163.           val_print (elttype, valaddr + i * eltlen,
  164.                  0, stream, format);
  165.         }
  166.           if (i < len)
  167.         fprintf_filtered (stream, "...");
  168.         }
  169.       fprintf_filtered (stream, "}");
  170.       break;
  171.     }
  172.       /* Array of unspecified length: treat like pointer.  */
  173.       valaddr = (char *) &address;
  174.  
  175.     case TYPE_CODE_PTR:
  176.       if (format)
  177.     {
  178.       print_scalar_formatted (valaddr, type, format, 0, stream);
  179.       break;
  180.     }
  181.       fprintf_filtered (stream, "0x%x", * (int *) valaddr);
  182.       /* For a pointer to char or unsigned char,
  183.      also print the string pointed to, unless pointer is null.  */
  184.  
  185.       /* For an array of chars, print with string syntax.  */
  186.       elttype = TYPE_TARGET_TYPE (type);
  187.       if (TYPE_LENGTH (elttype) == 1 && TYPE_CODE (elttype) == TYPE_CODE_INT
  188.       && format == 0
  189.       && unpack_long (type, valaddr) != 0)
  190.     {
  191.       fputc_filtered (' ', stream);
  192.       fputc_filtered ('"', stream);
  193.       for (i = 0; i < print_max; i++)
  194.         {
  195.           QUIT;
  196.           read_memory (unpack_long (type, valaddr) + i, &c, 1);
  197.           if (c == 0)
  198.         break;
  199.           printchar (c, stream);
  200.         }
  201.       fputc_filtered ('"', stream);
  202.       if (i == print_max)
  203.         fprintf_filtered (stream, "...");
  204.       fflush (stream);
  205.       /* Return number of characters printed, plus one for the
  206.          terminating null if we have "reached the end".  */
  207.       return i + (print_max && i != print_max);
  208.     }
  209.       break;
  210.  
  211.     case TYPE_CODE_STRUCT:
  212.     case TYPE_CODE_UNION:
  213.       fprintf_filtered (stream, "{");
  214.       len = TYPE_NFIELDS (type);
  215.       for (i = 0; i < len; i++)
  216.     {
  217.       if (i) fprintf_filtered (stream, ", ");
  218.       fprintf_filtered (stream, "%s = ", TYPE_FIELD_NAME (type, i));
  219.       if (TYPE_FIELD_PACKED (type, i))
  220.         {
  221.           val = unpack_field_as_long (type, valaddr, i);
  222.           val_print (TYPE_FIELD_TYPE (type, i), &val, 0, stream, format);
  223.         }
  224.       else
  225.         val_print (TYPE_FIELD_TYPE (type, i), 
  226.                valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
  227.                0, stream, format);
  228.     }
  229.       fprintf_filtered (stream, "}");
  230.       break;
  231.  
  232.     case TYPE_CODE_ENUM:
  233.       if (format)
  234.     {
  235.       print_scalar_formatted (valaddr, type, format, 0, stream);
  236.       break;
  237.     }
  238.       len = TYPE_NFIELDS (type);
  239.       val = unpack_long (builtin_type_int, valaddr);
  240.       for (i = 0; i < len; i++)
  241.     {
  242.       QUIT;
  243.       if (val == TYPE_FIELD_VALUE (type, i))
  244.         break;
  245.     }
  246.       if (i < len)
  247.     fprintf_filtered (stream, "%s", TYPE_FIELD_NAME (type, i));
  248.       else
  249.     fprintf_filtered (stream, "%d", val);
  250.       break;
  251.  
  252.     case TYPE_CODE_FUNC:
  253.       if (format)
  254.     {
  255.       print_scalar_formatted (valaddr, type, format, 0, stream);
  256.       break;
  257.     }
  258.       fprintf_filtered (stream, "{");
  259.       type_print (type, "", stream, -1);
  260.       fprintf_filtered (stream, "} ");
  261.       fprintf_filtered (stream, "0x%x", address);
  262.       break;
  263.  
  264.     case TYPE_CODE_INT:
  265.       if (format)
  266.     {
  267.       print_scalar_formatted (valaddr, type, format, 0, stream);
  268.       break;
  269.     }
  270.       fprintf_filtered (stream,
  271.            TYPE_UNSIGNED (type) ? "%u" : "%d",
  272.            unpack_long (type, valaddr));
  273.       if (TYPE_LENGTH (type) == 1)
  274.     {
  275.       fprintf_filtered (stream, " '");
  276.       printchar (unpack_long (type, valaddr), stream);
  277.       fputc_filtered ('\'', stream);
  278.     }
  279.       break;
  280.  
  281.     case TYPE_CODE_FLT:
  282.       if (format)
  283.     {
  284.       print_scalar_formatted (valaddr, type, format, 0, stream);
  285.       break;
  286.     }
  287. #ifdef IEEE_FLOAT
  288.       if (is_nan (unpack_double (type, valaddr)))
  289.     {
  290.       fprintf_filtered (stream, "Nan");
  291.       break;
  292.     }
  293. #endif
  294.       fprintf_filtered (stream, "%g", unpack_double (type, valaddr));
  295.       break;
  296.  
  297.     case TYPE_CODE_VOID:
  298.       fprintf_filtered (stream, "void");
  299.       break;
  300.  
  301.     default:
  302.       error ("Invalid type code in symbol table.");
  303.     }
  304.   fflush (stream);
  305.   return 0;
  306. }
  307.  
  308. #ifdef IEEE_FLOAT
  309.  
  310. union ieee {
  311.   int i[2];
  312.   double d;
  313. };
  314.  
  315. /* Nonzero if ARG (a double) is a NAN.  */
  316.  
  317. int
  318. is_nan (arg)
  319.      union ieee arg;
  320. {
  321.   int lowhalf, highhalf;
  322.   union { int i; char c; } test;
  323.  
  324.   /* Separate the high and low words of the double.
  325.      Distinguish big and little-endian machines.  */
  326.   test.i = 1;
  327.   if (test.c != 1)
  328.     /* Big-endian machine */
  329.     lowhalf = arg.i[1], highhalf = arg.i[0];
  330.   else
  331.     lowhalf = arg.i[0], highhalf = arg.i[1];
  332.  
  333.   /* Nan: exponent is the maximum possible, and fraction is nonzero.  */
  334.   return (((highhalf>>20) & 0x7ff) == 0x7ff
  335.       &&
  336.       ! ((highhalf & 0xfffff == 0) && (lowhalf == 0)));
  337. }
  338. #endif
  339.  
  340. /* Print a description of a type TYPE
  341.    in the form of a declaration of a variable named VARSTRING.
  342.    Output goes to STREAM (via stdio).
  343.    If SHOW is positive, we show the contents of the outermost level
  344.    of structure even if there is a type name that could be used instead.
  345.    If SHOW is negative, we never show the details of elements' types.  */
  346.  
  347. type_print (type, varstring, stream, show)
  348.      struct type *type;
  349.      char *varstring;
  350.      FILE *stream;
  351.      int show;
  352. {
  353.   type_print_1 (type, varstring, stream, show, 0);
  354. }
  355.  
  356. /* LEVEL is the depth to indent lines by.  */
  357.  
  358. type_print_1 (type, varstring, stream, show, level)
  359.      struct type *type;
  360.      char *varstring;
  361.      FILE *stream;
  362.      int show;
  363.      int level;
  364. {
  365.   register enum type_code code;
  366.   type_print_base (type, stream, show, level);
  367.   code = TYPE_CODE (type);
  368.   if ((varstring && *varstring)
  369.       ||
  370.       /* Need a space if going to print stars or brackets;
  371.      but not if we will print just a type name.  */
  372.       ((show > 0 || TYPE_NAME (type) == 0)
  373.        &&
  374.        (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
  375.     || code == TYPE_CODE_ARRAY)))
  376.     fprintf_filtered (stream, " ");
  377.   type_print_varspec_prefix (type, stream, show, 0);
  378.   fprintf_filtered (stream, "%s", varstring);
  379.   type_print_varspec_suffix (type, stream, show, 0);
  380. }
  381.  
  382. /* Print any asterisks or open-parentheses needed before the
  383.    variable name (to describe its type).
  384.  
  385.    On outermost call, pass 0 for PASSED_A_PTR.
  386.    On outermost call, SHOW > 0 means should ignore
  387.    any typename for TYPE and show its details.
  388.    SHOW is always zero on recursive calls.  */
  389.  
  390. static void
  391. type_print_varspec_prefix (type, stream, show, passed_a_ptr)
  392.      struct type *type;
  393.      FILE *stream;
  394.      int show;
  395.      int passed_a_ptr;
  396. {
  397.   if (type == 0)
  398.     return;
  399.  
  400.   if (TYPE_NAME (type) && show <= 0)
  401.     return;
  402.  
  403.   QUIT;
  404.  
  405.   switch (TYPE_CODE (type))
  406.     {
  407.     case TYPE_CODE_PTR:
  408.       type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
  409.       fputc_filtered ('*', stream);
  410.       break;
  411.  
  412.     case TYPE_CODE_FUNC:
  413.     case TYPE_CODE_ARRAY:
  414.       type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
  415.       if (passed_a_ptr)
  416.     fputc_filtered ('(', stream);
  417.       break;
  418.  
  419.     default:
  420.       break;
  421.     }
  422. }
  423.  
  424. /* Print any array sizes, function arguments or close parentheses
  425.    needed after the variable name (to describe its type).
  426.    Args work like type_print_varspec_prefix.  */
  427.  
  428. static void
  429. type_print_varspec_suffix (type, stream, show, passed_a_ptr)
  430.      struct type *type;
  431.      FILE *stream;
  432.      int show;
  433.      int passed_a_ptr;
  434. {
  435.   if (type == 0)
  436.     return;
  437.  
  438.   if (TYPE_NAME (type) && show <= 0)
  439.     return;
  440.  
  441.   QUIT;
  442.  
  443.   switch (TYPE_CODE (type))
  444.     {
  445.     case TYPE_CODE_ARRAY:
  446.       if (passed_a_ptr)
  447.     fprintf_filtered (stream, ")");
  448.       fprintf_filtered (stream, "[");
  449.       if (TYPE_LENGTH (type) >= 0)
  450.     fprintf_filtered (stream, "%d",
  451.          TYPE_LENGTH (type) / TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
  452.       fprintf_filtered (stream, "]");
  453.       type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0);
  454.       break;
  455.  
  456.     case TYPE_CODE_PTR:
  457.       type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1);
  458.       break;
  459.  
  460.     case TYPE_CODE_FUNC:
  461.       type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
  462.                  passed_a_ptr);
  463.       if (passed_a_ptr)
  464.     fprintf_filtered (stream, ")");
  465.       fprintf_filtered (stream, "()");
  466.       break;
  467.  
  468.     default:
  469.       break;
  470.     }
  471. }
  472.  
  473. /* Print the name of the type (or the ultimate pointer target,
  474.    function value or array element), or the description of a
  475.    structure or union.
  476.  
  477.    SHOW nonzero means don't print this type as just its name;
  478.    show its real definition even if it has a name.
  479.    SHOW zero means print just typename or struct tag if there is one
  480.    SHOW negative means abbreviate structure elements.
  481.    SHOW is decremented for printing of structure elements.
  482.  
  483.    LEVEL is the depth to indent by.
  484.    We increase it for some recursive calls.  */
  485.  
  486. static void
  487. type_print_base (type, stream, show, level)
  488.      struct type *type;
  489.      FILE *stream;
  490.      int show;
  491.      int level;
  492. {
  493.   char *name;
  494.   register int i;
  495.   register int len;
  496.   register int lastval;
  497.  
  498.   QUIT;
  499.  
  500.   if (type == 0)
  501.     {
  502.       fprintf_filtered (stream, "type unknown");
  503.       return;
  504.     }
  505.  
  506.   if (TYPE_NAME (type) && show <= 0)
  507.     {
  508.       fprintf_filtered (stream, TYPE_NAME (type));
  509.       return;
  510.     }
  511.  
  512.   switch (TYPE_CODE (type))
  513.     {
  514.     case TYPE_CODE_ARRAY:
  515.     case TYPE_CODE_PTR:
  516.     case TYPE_CODE_FUNC:
  517.       type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
  518.       break;
  519.  
  520.     case TYPE_CODE_STRUCT:
  521.       fprintf_filtered (stream, "struct ");
  522.       goto struct_union;
  523.  
  524.     case TYPE_CODE_UNION:
  525.       fprintf_filtered (stream, "union ");
  526.     struct_union:
  527.       if (TYPE_NAME (type) && (name = TYPE_NAME (type)))
  528.     {
  529.       while (*name != ' ') name++;
  530.       fprintf_filtered (stream, "%s ", name + 1);
  531.     }
  532.       if (show < 0)
  533.     fprintf_filtered (stream, "{...}");
  534.       else
  535.     {
  536.       fprintf_filtered (stream, "{");
  537.       len = TYPE_NFIELDS (type);
  538.       if(len)
  539.           fprintf_filtered (stream, "\n");
  540.       else
  541.           fprintf_filtered(stream, "<no data fields>\n");
  542.       for (i = 0; i < len; i++)
  543.         {
  544.           QUIT;
  545.           print_spaces (level + 4, stream);
  546.  
  547.           /* If this is a bit-field and there is a gap before it,
  548.          print a nameless field to account for the gap.  */
  549.  
  550.           if (TYPE_FIELD_PACKED (type, i))
  551.         {
  552.           int gap = (TYPE_FIELD_BITPOS (type, i)
  553.                  - (i > 0
  554.                 ? (TYPE_FIELD_BITPOS (type, i - 1)
  555.                    + (TYPE_FIELD_PACKED (type, i - 1)
  556.                       ? TYPE_FIELD_BITSIZE (type, i - 1)
  557.                       : TYPE_LENGTH (TYPE_FIELD_TYPE (type, i - 1)) * 8))
  558.                 : 0));
  559.           if (gap != 0)
  560.             {
  561.               fprintf_filtered (stream, "int : %d;\n", gap);
  562.               print_spaces (level + 4, stream);
  563.             }
  564.         }
  565.  
  566.           /* Print the declaration of this field.  */
  567.  
  568.           type_print_1 (TYPE_FIELD_TYPE (type, i),
  569.                 TYPE_FIELD_NAME (type, i),
  570.                 stream, show - 1, level + 4);
  571.  
  572.           /* Print the field width.  */
  573.  
  574.           if (TYPE_FIELD_PACKED (type, i))
  575.         fprintf_filtered (stream, " : %d", TYPE_FIELD_BITSIZE (type, i));
  576.  
  577.           fprintf_filtered (stream, ";\n");
  578.         }
  579.       print_spaces (level, stream);
  580.       fputc_filtered ('}', stream);
  581.     }
  582.       break;
  583.  
  584.     case TYPE_CODE_ENUM:
  585.       fprintf_filtered (stream, "enum ");
  586.       if (TYPE_NAME (type))
  587.     {
  588.       name = TYPE_NAME (type);
  589.       while (*name != ' ') name++;
  590.       fprintf_filtered (stream, "%s ", name + 1);
  591.     }
  592.       if (show < 0)
  593.     fprintf_filtered (stream, "{...}");
  594.       else
  595.     {
  596.       fprintf_filtered (stream, "{");
  597.       len = TYPE_NFIELDS (type);
  598.       lastval = 0;
  599.       for (i = 0; i < len; i++)
  600.         {
  601.           QUIT;
  602.           if (i) fprintf_filtered (stream, ", ");
  603.           fprintf_filtered (stream, "%s", TYPE_FIELD_NAME (type, i));
  604.           if (lastval != TYPE_FIELD_VALUE (type, i))
  605.         {
  606.           fprintf_filtered (stream, " : %d", TYPE_FIELD_VALUE (type, i));
  607.           lastval = TYPE_FIELD_VALUE (type, i);
  608.         }
  609.           lastval++;
  610.         }
  611.       fprintf_filtered (stream, "}");
  612.     }
  613.       break;
  614.  
  615.     case TYPE_CODE_INT:
  616.       if (TYPE_UNSIGNED (type))
  617.     name = unsigned_type_table[TYPE_LENGTH (type)];
  618.       else
  619.     name = signed_type_table[TYPE_LENGTH (type)];
  620.       fprintf_filtered (stream, "%s", name);
  621.       break;
  622.  
  623.     case TYPE_CODE_FLT:
  624.       name = float_type_table[TYPE_LENGTH (type)];
  625.       fprintf_filtered (stream, "%s", name);
  626.       break;
  627.  
  628.     case TYPE_CODE_VOID:
  629.       fprintf_filtered (stream, "void");
  630.       break;
  631.  
  632.     case 0:
  633.       fprintf_filtered (stream, "struct unknown");
  634.       break;
  635.  
  636.     default:
  637.       error ("Invalid type code in symbol table.");
  638.     }
  639. }
  640.  
  641. static void
  642. set_maximum_command (arg)
  643.      char *arg;
  644. {
  645.   if (!arg) error_no_arg ("value for maximum elements to print");
  646.   print_max = atoi (arg);
  647. }
  648.  
  649. void
  650. initialize_valprint ()
  651. {
  652.   add_com ("set-maximum", class_vars, set_maximum_command,
  653.        "Set NUMBER as limit on string chars or array elements to print.");
  654.  
  655.   print_max = 200;
  656.  
  657.   unsigned_type_table
  658.     = (char **) xmalloc ((1 + sizeof (unsigned long)) * sizeof (char *));
  659.   bzero (unsigned_type_table, (1 + sizeof (unsigned long)));
  660.   unsigned_type_table[sizeof (unsigned char)] = "unsigned char";
  661.   unsigned_type_table[sizeof (unsigned short)] = "unsigned short";
  662.   unsigned_type_table[sizeof (unsigned long)] = "unsigned long";
  663.   unsigned_type_table[sizeof (unsigned int)] = "unsigned int";
  664.  
  665.   signed_type_table
  666.     = (char **) xmalloc ((1 + sizeof (long)) * sizeof (char *));
  667.   bzero (signed_type_table, (1 + sizeof (long)));
  668.   signed_type_table[sizeof (char)] = "char";
  669.   signed_type_table[sizeof (short)] = "short";
  670.   signed_type_table[sizeof (long)] = "long";
  671.   signed_type_table[sizeof (int)] = "int";
  672.  
  673.   float_type_table
  674.     = (char **) xmalloc ((1 + sizeof (double)) * sizeof (char *));
  675.   bzero (float_type_table, (1 + sizeof (double)));
  676.   float_type_table[sizeof (float)] = "float";
  677.   float_type_table[sizeof (double)] = "double";
  678. }
  679.